From d924a4a766d3f895acbddf02d01db1e3f049f899 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Thu, 4 Aug 2022 14:05:06 +0200 Subject: [PATCH] Calculate format string only once --- which-key.el | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/which-key.el b/which-key.el index 19d1f9fb3d1..d9dcf8dee9a 100644 --- a/which-key.el +++ b/which-key.el @@ -1874,13 +1874,12 @@ that width." (col-sep-width (which-key--max-len col-keys 1)) (col-desc-width (which-key--max-len col-keys 2 which-key-min-column-description-width)) - (col-width (+ 1 col-key-width col-sep-width col-desc-width))) + (col-width (+ 1 col-key-width col-sep-width col-desc-width)) + (col-format (concat "%" (int-to-string col-key-width) + "s%s%-" (int-to-string col-desc-width) "s"))) (cons col-width - (mapcar (lambda (k) - (format (concat "%" (int-to-string col-key-width) - "s%s%-" (int-to-string col-desc-width) "s") - (nth 0 k) (nth 1 k) (nth 2 k))) - col-keys)))) + (mapcar (lambda (k) (apply #'format col-format k)) + col-keys)))) (defun which-key--partition-list (n list) "Partition LIST into N-sized sublists." -- 2.30.2